<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateHsCodesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('hs_codes', function (Blueprint $table) {
            $table->char('code', 10)->unique()->comment("海关代码");
            $table->string('name')->comment('海关名称');
            $table->char('unit1', 3)->comment('法定第一单位');
            $table->char('unit2', 3)->nullable()->comment('法定第二单位');
            $table->string('element', 255)->comment('申报要素');
            $table->primary(['code']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('hs_codes');
    }
}
